package com.authine.cloudpivot.ext.enums.system;

import io.swagger.annotations.Api;

import java.util.Arrays;

/**
 * 定时器状态
 *
 * @author fj
 */

@Api("定时器状态")
public enum TriggerMetaStatusEnum {

    UNENFORCED("0", "未执行"),
    EXECUTED("1", "已执行"),
    FAILED("2", "失败");

    public String id;
    public String name;

    TriggerMetaStatusEnum(String id, String name) {

        this.id = id;
        this.name = name;
    }

    public static TriggerMetaStatusEnum get(String id) {

        return Arrays.stream(TriggerMetaStatusEnum.values()).filter(v -> v.id.equals(id)).findFirst().orElse(null);
    }

    @Override
    public String toString() {

        return "TriggerMetaStatusEnum(id=" + this.id + ", name=" + this.name + ")";
    }
}
